/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.fzhucc.modules.thinktank.controller;

import com.fzhucc.annotation.Log;
import com.fzhucc.modules.thinktank.domain.dto.CompanyProjectDistributionDto;
import com.fzhucc.modules.thinktank.domain.dto.CompanyProjectLogQueryCriteria;
import com.fzhucc.modules.thinktank.domain.dto.ThinktankProjectDistributionDto;
import com.fzhucc.modules.thinktank.service.CompanyProjectLogService;
import com.fzhucc.modules.thinktank.service.ThinktankProjectLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author yyg
 * @date 2023-01-03
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "智库：分配项目管理")
@RequestMapping("/api/thinktankProjectLog")
public class ThinktankProjectLogController {

    private final ThinktankProjectLogService thinktankProjectLogService;



    @Log("智库、专家项目分配")
    @ApiOperation("智库、专家项目分配")
    @PostMapping("/distribution")
    public ResponseEntity<Object> distribution(@RequestBody ThinktankProjectDistributionDto thinktankProjectDistributionDto){
        thinktankProjectLogService.dodistribution(thinktankProjectDistributionDto);
        return new ResponseEntity<>(HttpStatus.OK);
    }

    @Log("通过项目查询智库列表")
    @ApiOperation("通过项目查询智库列表")
    @GetMapping("/getAllByProjectId")
    public ResponseEntity<Object> getAllByProjectId(String projectId){
        return new ResponseEntity<>(thinktankProjectLogService.getAllByProjectId(projectId), HttpStatus.OK);
    }


}